<!doctype html>
<html lang="zh_cn" itemscope itemtype="http://schema.org/Person">
<head>
            <meta charset="utf-8">
        <!-- Site Meta Data -->
        <title>用 dig 或 nslookup 命令查询txt解析记录</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="技术博客,涉及Java/PHP/Python/Javascript等,聊聊程序,聊聊生活,聊聊事实,聊聊育儿">
        <meta name="keywords" content="编码经验,技术分享,生活积累,实事评说">
        <meta name="author" content="布丁缘">

        <link rel="shortcut icon" href="">

        <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700' rel='stylesheet' type='text/css'>
        <!-- Style Meta Data -->
        <link rel="stylesheet" href="https://www.ddkiss.com/theme/css/style.css" type="text/css"/>
        <link rel="stylesheet" href="https://www.ddkiss.com/theme/css/pygments.css" type="text/css"/>

        <!-- Feed Meta Data -->
            <link href="https://www.ddkiss.com/feeds/all.atom.xml" type="application/atom+xml" rel="alternate"
                  title="一个程序员的简单生活 ATOM Feed"/>


    <meta name="keywords" content="">
    <link rel="stylesheet" href="//dn-coding-net-public-file.qbox.me/Coding-Comments/v0.1.0/default.css">
</head>

<body>
<!-- Sidebar -->
<aside>
    <center><h1><a href="/" style="color:#fff"><img id="avatar" src="/images/avatar.jpg"></a></h1></center>
        <p>一个程序员的简单生活</p>
    <br>
    <nav class="nav">
        <ul class="list-bare">
                <li><a class="nav__link" href="https://www.ddkiss.com/category/chang-yong-ji-qiao.html">常用技巧</a></li>
                <li><a class="nav__link" href="https://www.ddkiss.com/category/kai-fa-huan-jing.html">开发环境</a></li>
                <li><a class="nav__link" href="https://www.ddkiss.com/category/sheng-huo-dian-di.html">生活点滴</a></li>

                <li><a class="nav__link" href="/pages/books.html">书单</a></li>
                <li><a class="nav__link" href="/pages/movies.html">影单</a></li>
                <li><a class="nav__link" href="/pages/downloads.html">下载</a></li>
                <li><a class="nav__link" href="/pages/about.html">关于我</a></li>


        </ul>
    </nav>


    <form>
      <input type="text"  id="bdcsMain"/>
    </form>

</aside>

<!-- Content -->
<article>
  <main>
    <nav>
      <a href="/">首页</a>
      <a href="/archives.html">归档</a>
      <a href="/categories.html">分类</a>
      <a href="/tags.html">标签</a>
      <a href="/pages/about.html">关于我</a>
    </nav>
  </main>
    <section id="content">
        <article>
            <h2 class="post_title post_detail"><a href="https://www.ddkiss.com/archives/45.html" rel="bookmark"
                                                  title="Permalink to 用 dig 或 nslookup 命令查询txt解析记录">用 dig 或 nslookup 命令查询txt解析记录</a></h2>

            <div class="post_list">
                <span>作者：</span><a href="https://www.ddkiss.com/author/bu-ding-yuan.html">布丁缘</a>
                <span class="post_category">分类：<a href="https://www.ddkiss.com/category/kai-fa-huan-jing.html" rel="bookmark"
                                               title="Permalink to 开发环境">开发环境</a></span>
                <span class="post_date">  时间：2017-10-10 11:48:00</span>

            </div>
            <div class="entry-content blog-post">
                <p>这几天想把HTTPS装上，阿里云的免费证书需要在域名解析的地方添加TXT记录。文档里用的是dig命令，我本地装了nslookup。试验下如何用咯。</p>
<h2>dig命令</h2>
<p>dig用法很多，这里只使用<code>dig txt blog.xxx.com @8.8.8.8</code> 校验是否添加了txt记录</p>
<div class="highlight"><pre><span></span><span class="n">sang</span><span class="p">@</span><span class="n">sang</span><span class="o">-</span><span class="nl">ssd</span><span class="p">:</span><span class="o">~</span><span class="err">$</span> <span class="n">dig</span> <span class="n">txt</span> <span class="n">blog</span><span class="p">.</span><span class="n">xxx</span><span class="p">.</span><span class="n">com</span> <span class="mf">@8.8.8.8</span>

<span class="p">;</span> <span class="o">&lt;&lt;&gt;&gt;</span> <span class="n">DiG</span> <span class="mf">9.9.5</span><span class="o">-</span><span class="mi">3u</span><span class="n">buntu0</span><span class="mf">.4</span><span class="o">-</span><span class="n">Ubuntu</span> <span class="o">&lt;&lt;&gt;&gt;</span> <span class="n">txt</span> <span class="n">blog</span><span class="p">.</span><span class="n">xxx</span><span class="p">.</span><span class="n">com</span> <span class="mf">@8.8.8.8</span>
<span class="p">;;</span> <span class="n">global</span> <span class="nl">options</span><span class="p">:</span> <span class="o">+</span><span class="n">cmd</span>
<span class="p">;;</span> <span class="n">Got</span> <span class="nl">answer</span><span class="p">:</span>
<span class="p">;;</span> <span class="o">-&gt;&gt;</span><span class="n">HEADER</span><span class="o">&lt;&lt;-</span> <span class="nl">opcode</span><span class="p">:</span> <span class="n">QUERY</span><span class="p">,</span> <span class="nl">status</span><span class="p">:</span> <span class="n">NOERROR</span><span class="p">,</span> <span class="kt">id</span><span class="o">:</span> <span class="mi">38752</span>
<span class="p">;;</span> <span class="nl">flags</span><span class="p">:</span> <span class="n">qr</span> <span class="n">rd</span> <span class="n">ra</span><span class="p">;</span> <span class="nl">QUERY</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nl">ANSWER</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nl">AUTHORITY</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="nl">ADDITIONAL</span><span class="p">:</span> <span class="mi">1</span>

<span class="p">;;</span> <span class="n">OPT</span> <span class="nl">PSEUDOSECTION</span><span class="p">:</span>
<span class="p">;</span> <span class="nl">EDNS</span><span class="p">:</span> <span class="nl">version</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="nl">flags</span><span class="p">:;</span> <span class="nl">udp</span><span class="p">:</span> <span class="mi">4096</span>
<span class="p">;;</span> <span class="n">QUESTION</span> <span class="nl">SECTION</span><span class="p">:</span>
<span class="p">;</span><span class="n">blog</span><span class="p">.</span><span class="n">xxx</span><span class="p">.</span><span class="n">com</span><span class="p">.</span>            <span class="n">IN</span>      <span class="n">TXT</span>

<span class="p">;;</span> <span class="n">ANSWER</span> <span class="nl">SECTION</span><span class="p">:</span>
<span class="n">blog</span><span class="p">.</span><span class="n">xxx</span><span class="p">.</span><span class="n">com</span><span class="p">.</span>     <span class="mi">1780</span>    <span class="n">IN</span>      <span class="n">TXT</span>     <span class="s">&quot;2017061300000065jk97bbbpuq25wlofojds65ldv7w186idsq00ju&quot;</span>

<span class="p">;;</span> <span class="n">Query</span> <span class="nl">time</span><span class="p">:</span> <span class="mi">2</span> <span class="n">msec</span>
<span class="p">;;</span> <span class="nl">SERVER</span><span class="p">:</span> <span class="mf">8.8.8.8</span><span class="err">#</span><span class="mi">53</span><span class="p">(</span><span class="mf">8.8.8.8</span><span class="p">)</span>
<span class="p">;;</span> <span class="nl">WHEN</span><span class="p">:</span> <span class="n">Tue</span> <span class="n">Oct</span> <span class="mi">10</span> <span class="mi">11</span><span class="o">:</span><span class="mi">44</span><span class="o">:</span><span class="mo">05</span> <span class="n">CST</span> <span class="mi">2017</span>
<span class="p">;;</span> <span class="n">MSG</span> <span class="n">SIZE</span>  <span class="nl">rcvd</span><span class="p">:</span> <span class="mi">124</span>
</pre></div>


<h2>nslookup命令</h2>
<p>以前不知道它还可以交互式使用，比如下面的例子</p>
<div class="highlight"><pre><span></span>sang@sang-ssd:~$ nslookup
&gt; set type=txt
&gt; blog.xxx.com
Server:         127.0.1.1
Address:        127.0.1.1#53

Non-authoritative answer:
blog.xxx.com      text = &quot;2017061300000065jk97bbbpuq25wlofojds65ldv7w186idsq00ju&quot;

Authoritative answers can be found from:
&gt;
</pre></div>


<p>看起来比dig命令要简洁。</p>
            </div>
            <div class="post_list">
              <div><span>Tags : </span>
              </div>
            </div>
        </article>
        <div id="container"></div>
        <script type="text/javascript" src="//dn-coding-net-public-file.qbox.me/Coding-Comments/v0.1.0/gitment.min.js"></script>
        <script>
            var gitment = new Gitment({
              owner: 'whusl',
              repo: 'BlogComments',
              oauth: {
                client_id: '621866266817529fba46681653017809',
                client_secret: '14188411740b12ae52159cee9b586bf85cd54125',
              },
            })
            document.getElementById('container').appendChild(gitment.render())
          </script>
    </section>
</article>

<!-- Footer -->
    <footer>
        <p> &copy;2017-2020&nbsp;<a href="http://www.miitbeian.gov.cn/" target="_blank">鄂ICP备17020200号</a>
          Blog powered by <a href="http://getpelican.com/">Pelican</a>
        </p>
    </footer>

    <!-- Analytics -->
    <script>
      var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?88c55edaf311dbacac56a16316b04c8b";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>

<script type="text/javascript">(function(){document.write(unescape('%3Cdiv id="bdcs"%3E%3C/div%3E'));var bdcs = document.createElement('script');bdcs.type = 'text/javascript';bdcs.async = true;bdcs.src = 'http://znsv.baidu.com/customer_search/api/js?sid=14490611060029767912' + '&plate_url=' + encodeURIComponent(window.location.href) + '&t=' + Math.ceil(new Date()/3600000);var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(bdcs, s);})();</script>

</body>
</html>